<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			let Array=[]
			function fun(){
				let  username=document.getElementById("username").value;
				let msg=document.getElementById("msg").value;
				let msgs=document.getElementById("msgs");
				// let temp="["+username+"]说："+msg+" ";
				let temp=`[${username}]说:$[msg]`
				Array.unshift(temp)
				if(Array.length>10){
				Array.pop()
				}
				msgs.value=Array.join("\n")
			}
		</script>
	</head>
	<body>
		<form >
		姓名：<input type="text" id="username" /><br>
		留言<textarea rows="3" id="msg" cols="30" style="resize: none;vertical-align: middle;"></textarea><br>
		<input type="reset" value="重置"  />
		<button type="button" onclick="fun()">留言</button>
		</form>
		<hr>
		<textarea id="msgs" rows="10" cols="50" disabled="disabled" style="resize:none;"></textarea>
	</body>
</html>
